
<?php
$aksi="module/mahasiswa/aksi.php";
switch($_GET[act]){
  // Tampil Berita
  default:
?>
<h2>Kelulusan Mahasiswa Non Skripsi</h2>
<?php echo "<input type=button value='Input Nilai' onclick=\"window.location.href='?mod=nonskripsi&act=inputnilai';\">"; ?>
<table width="490" >
  <tr >
    <th width="20">No</th>
    <th width="144">npk</th>
    <th width="150">Nama</th>
    <th width="150">Jurusan</th>
    <th width="156">Aksi</th>
  </tr>
 <?php 
 
 	$p      = new Paging;
    $batas  = 5;
    $posisi = $p->cariPosisi($batas);
 
 		$sql="SELECT
kelulusan_non_skripsi.id_klsns,
kelulusan_non_skripsi.no_klsns,
kelulusan_non_skripsi.nip,
kelulusan_non_skripsi.id_nilai,
nilai.npk,
nilai.ipk_terahir,
mahasiswa.nama
FROM
kelulusan_non_skripsi
Inner Join nilai ON kelulusan_non_skripsi.id_nilai = nilai.id_nilai
Inner Join mahasiswa ON nilai.npk = mahasiswa.npk


 ";
 		$query=@mysql_query($sql);
	$no=1 + $posisi;
		while ($data=@mysql_fetch_array($query)){
  ?>
   <tr class="<?php if ($no %2 == 0):echo "zebra";else:echo "zebra2"; endif;?>" align="center">
    <td><?php echo $no; ?></td>
    <td><?php echo $data['npk']; ?></td>
    <td><?php echo $data['nama']; ?></td>
     <td><?php $jurusan=substr($data['npk'],0,2);
	  		if($jurusan==10){
			echo "D3 Akutansi";
			}
			elseif($jurusan==11){
			echo "S1 Akutansi";
			}
			elseif($jurusan==21){
			echo "S1 Manajemen";
			}
			elseif($jurusan==30){
			echo "D3 Perdagangan";
			}			
	  ?></td>
     <td align="center"><a href=?mod=nonskripsi&act=editnilai&id=<?php echo "$data[id_klsns]"; ?>>Edit </a>| 
     <?php echo "<a href=$aksi?mod=nonskripsi&act=hapus&id=$data[id_nilai]>"; ?>Hapus</a> </td>
  </tr>
  
 <?php 
 $no++;
 } ?>
</table>
<center><?php 
    $jmldata = mysql_num_rows(mysql_query("SELECT * FROM slide"));
    $jmlhalaman  = $p->jumlahHalaman($jmldata, $batas);
    $linkHalaman = $p->navHalaman($_GET[halaman], $jmlhalaman);

    echo "<div id=paging>$linkHalaman</div><br>";
break;
  case "inputnilai":
  ?>
  <h2>Input  Kelulusan Mahasiswa Non Skripsi</h2>
<?php echo "
  <form method=POST action='$aksi?mod=nonskripsi&act=input' enctype='multipart/form-data'>"; ?>
  <table width="591" >
    <tr>
      <td width="144">NO</td>
    
      <td width="435"><input type=text name='jns_no' value="2" readonly="readonly" size=4><input type=text name='no' value="0001" readonly="readonly" size=4>
      				  <input type=text name='jurusan' value="PK I S-1 Akt"  readonly="readonly" size=10>
       				  <input type=text name='kampus' value=" STEI " readonly="readonly" size=4></select>
			<select name="no_bulan" style="width:70px">
			<option value="I">Jan</option>
			<option value="II">Feb</option>
			<option value="III">Mar</option>
			<option value="IV">Apr</option>
			<option value="V">Mei</option>
			<option value="VI">Jun</option>
			<option value="VII">Jul</option>
			<option value="VIII">Ags</option>
			<option value="IX">Sep</option>
			<option value="X">Okt</option>
			<option value="XI">Nov</option>
			<option value="XII">Des</option>
			</select><select name="no_tahun" style="width:72px">
			<?PHP
			$tahun = 2000; 
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
	  </select></td>
    </tr>
    <tr>
      <td width="144">NIP Dosen</td>
    
      <td width="435"><select name="nip" style="width:150px">
			<?PHP
			$sql="select * from dosen";
			$query=@mysql_query($sql);
			
			while ($j=@mysql_fetch_array($query)){
			echo "<option value=$j[nip] >$j[nama]</option>";
			
			}
			?>
	   </select> </td>
    </tr>
     <tr>
      <td width="144">NPK Mahasiswa</td>
    
      <td width="435"><input type=text name='npk'  size=15> </td>
    </tr>
     <tr>
      <td width="144">Nilai IPK</td>
    
      <td width="435"><input type=text name='nilai'  size=15> </td>
    </tr>
   
    <tr>
      <td>&nbsp;</td>
      <td><input type=submit value=Simpan>
                            <input type=button value=Batal onclick=self.history.back()></td>
    </tr>
  </table>
</form>
  
<?php break; 
 case "editnilai":
 ?>
 <h2>Edit  Kelulusan Mahasiswa Non Skripsi</h2>
<?php echo "
  <form method=POST action='$aksi?mod=nonskripsi&act=update' enctype='multipart/form-data'>"; 
 $id=$_GET['id'];

			$sql="SELECT
					dosen.nama AS dosen,
					kelulusan_non_skripsi.id_nilai,
					kelulusan_non_skripsi.nip,
					kelulusan_non_skripsi.no_klsns,
					kelulusan_non_skripsi.id_klsns,
					nilai.ipk_terahir,
					nilai.npk
					FROM
					kelulusan_non_skripsi
					Inner Join dosen ON kelulusan_non_skripsi.nip = dosen.nip
					Inner Join nilai ON kelulusan_non_skripsi.id_nilai = nilai.id_nilai where kelulusan_non_skripsi.id_klsns=$id";  
 $query=@mysql_query($sql);
 $r=@mysql_fetch_array($query); 
  ?>
 <table width="591" >
    <tr>
      <td width="144">NO</td>
    
      <td width="435"><input type=text name='jns_no' value="2" readonly="readonly" size=4>
      <input type=text name='no' value="0001" readonly="readonly" size=4><input type=hidden name='id_nilai' value="<?=$r['id_nilai'];?>"><input type=hidden name='id' value="<?=$r['id_klsns'];?>">
      				  <input type=text name='jurusan' value="PK I S-1 Akt"  readonly="readonly" size=10>
       				  <input type=text name='kampus' value=" STEI " readonly="readonly" size=4></select>
			<select name="no_bulan" style="width:70px">
			<option value="I">Jan</option>
			<option value="II">Feb</option>
			<option value="III">Mar</option>
			<option value="IV">Apr</option>
			<option value="V">Mei</option>
			<option value="VI">Jun</option>
			<option value="VII">Jul</option>
			<option value="VIII">Ags</option>
			<option value="IX">Sep</option>
			<option value="X">Okt</option>
			<option value="XI">Nov</option>
			<option value="XII">Des</option>
			</select><select name="no_tahun" style="width:72px">
			<?PHP
			$tahun = 2000; 
			while ($tahun!=date('Y') + 1){
			echo "<option>$tahun</option>";
			$tahun++;
			}
			?>
	  </select></td>
    </tr>
    <tr>
      <td width="144">NIP Dosen</td>
    
      <td width="435"><select name="nip" style="width:150px">
			<?PHP
			$sql="select * from dosen";
			$query=@mysql_query($sql);
			
			while ($j=@mysql_fetch_array($query)){
			echo "<option value=$j[nip] >$j[nama]</option>";
			
			}
			?>
	   </select> </td>
    </tr>
     <tr>
      <td width="144">NPK Mahasiswa</td>
    
      <td width="435"><input type=hidden name='no_klss' value="<?php echo $r[no_klss]; ?>" >
      <input type=hidden name='id_nilai' value="<?php echo $r[id_nilai]; ?>" >  
      <input type=text name='npk' value="<?php echo $r[npk]; ?>" size=15> </td>
    </tr>
    
    <tr>
      <td width="144">Nilai IPK</td>
    
      <td width="435"><input type=text name='nilai' value="<?php echo $r[ipk_terahir]; ?>" size=15 /></td>
   </tr>
   
    <tr>
      <td>&nbsp;</td>
      <td><input type=submit value=Simpan>
                            <input type=button value=Batal onclick=self.history.back()></td>
    </tr>
  </table>
</form>
 <?php break; ?>
<?php } ?>